/**
 * 阅读tab相关接口
 */
import type { AddCollectionParams, GetCollectionListParams, GetCollectionListResult, GetCollectionStatusParams, GetCollectionStatusResult } from './type';
import { get, post } from '@/utils/request';

enum URL {
  getCollectionList = '/app/custCourse/collectionList',
  addCollection = '/app/custCourse/addCollection',
  delCollection = '/app/custCourse/delCollection',
  getCollectionStatus = '/app/custCourse/collectionStatus',
  shareCourse = '/app/custCourse/shareCourse',
}

// 收藏列表
export const getCollectionList = (data: GetCollectionListParams) => get<{ rows: GetCollectionListResult; total: number }>({ url: URL.getCollectionList, data });

// 点击收藏接口
export const addCollection = (data: AddCollectionParams) => post<any>({ url: URL.addCollection, data });

// 当前月份签到列表
export const delCollection = (data: { collectionId: string | number }) => post<any>({ url: URL.delCollection, data });

// 收藏状态
export const getCollectionStatus = (data: GetCollectionStatusParams) => post<GetCollectionStatusResult>({ url: URL.getCollectionStatus, data });

// 分享获得积分 type 3-课程 4-专栏
export const shareCourse = (data: GetCollectionStatusParams) => post<GetCollectionStatusResult>({ url: URL.shareCourse, data });
